package factory.method.abstractt.listfactory;

import factory.method.abstractt.factory.Item;
import factory.method.abstractt.factory.Tray;

public class ListTray extends Tray {

    public ListTray(String caption) {
        super(caption);
    }

    @Override
    public String makeHtml() {
        StringBuffer buffer = new StringBuffer();
        buffer.append("<li>");
        buffer.append(caption).append("\n");
        buffer.append("<ul>");
        for (Item item : tray) {
            buffer.append(item.makeHtml());
        }
        buffer.append("</ul>");
        buffer.append("</li>");
        return buffer.toString();
    }
}
